bitkeeper revision 1.102 (3e5ccddc9uBpJ0IXud6JDGQKpSZshw)
authorkaf24@labyrinth.cl.cam.ac.uk <kaf24@labyrinth.cl.cam.ac.uk>
Wed, 26 Feb 2003 14:23:24 +0000 (14:23 +0000)
committerkaf24@labyrinth.cl.cam.ac.uk <kaf24@labyrinth.cl.cam.ac.uk>
Wed, 26 Feb 2003 14:23:24 +0000 (14:23 +0000)
xen_serial.c:
  Fix serial handler.

xen/drivers/char/xen_serial.c

index 7b7e4a7b8053e09efe4c9f18f2630b1f3b10485e..4fba991997ccd8d8243061c18fe36aaba74772f1 100644 (file)
@@ -2,6 +2,7 @@
 #include <xeno/sched.h>    /* this has request_irq() proto for some reason */
 #include <xeno/keyhandler.h> 
 #include <xeno/reboot.h>
+#include <xeno/irq.h>
 
 /* Register offsets */
 #define NS16550_RBR    0x00    /* receive buffer       */
 
 #define SERIAL_BASE 0x3f8  /* XXX SMH: horrible hardwired COM1   */
 
-
-
 static int serial_echo = 0;   /* default is not to echo; change with 'e' */
 
+
 void toggle_echo(u_char key, void *dev_id, struct pt_regs *regs) 
 {
     serial_echo = !serial_echo; 
-    return; 
 }
 
-
-
 static void serial_rx_int(int irq, void *dev_id, struct pt_regs *regs)
 {
     u_char c; 
     key_handler *handler; 
 
-    /* XXX SMH: should probably check this is an RX interrupt :-) */
-
     /* clear the interrupt by reading the character */
-    c = inb(SERIAL_BASE + NS16550_RBR );
+    c = inb(SERIAL_BASE + NS16550_RBR);
 
     /* if there's a handler, call it: we trust it won't screw us too badly */
     if((handler = get_key_handler(c)) != NULL) 
@@ -70,8 +65,6 @@ static void serial_rx_int(int irq, void *dev_id, struct pt_regs *regs)
 
     if(serial_echo) 
        printk("%c", c); 
-
-    return; 
 }
 
 void initialize_serial() 
@@ -92,12 +85,6 @@ void initialize_serial()
     outb(NS16550_MCR_OUT2, SERIAL_BASE + NS16550_MCR);   /* Modem control */
     outb(NS16550_IER_ERDAI, SERIAL_BASE + NS16550_IER ); /* Setup interrupts */
 
-    /* XXX SMH: this is a hack; probably is IRQ4 but grab both anyway */
-    if((rc = request_irq(4, serial_rx_int, 0, "serial", (void *)0x1234)))
+    if((rc = request_irq(4, serial_rx_int, 0, "serial", 0)))
        printk("initialize_serial: failed to get IRQ4, rc=%d\n", rc); 
-
-    if((rc = request_irq(3, serial_rx_int, 0, "serial", (void *)0x1234)))
-       printk("initialize_serial: failed to get IRQ3, rc=%d\n", rc); 
-    
-    return; 
 }